﻿using System;
using System.IO;
using System.Text;
using Avalonia.Platform;
using FileManager.Lib;
using LuckyFish.FileManager.Models;
using Newtonsoft.Json;

namespace LuckyFish.FileManager.Serves;

public static class SettingServer
{
    public static SettingModel? Read()
    {
        var s = File.ReadAllText($"{CodeServer.CodePath}/Assets/Setting.json");
        return JsonConvert.DeserializeObject<SettingModel>(s);
    }

    public static void Save(SettingModel model)
    {
        File.WriteAllText($"{CodeServer.CodePath}/Assets/Setting.json", JsonConvert.SerializeObject(model));
    }
}